<?php
  class PublicAction extends Action{
	 public function verify(){
		  import('ORG.Util.Image'); 
	      Image::buildImageVerify(4,1,'png',70,30);
	 }
	 
	 //Email模块的公共头
	 public function email_header(){
		  $this->display(); 
	 }
	 //Email模块的公共尾
	 public function email_footer(){
		  $this->display();
	 }
	 //短信息模块公共头
	 public function message_header(){
		  $this->display();
	 }
	 //短信息模块公共尾
	 public function message_footer(){
		  $this->display(); 
	 }
	 //短信息模块公共头
	 public function notice_header(){
		  $this->display();
	 }
	 //短信息模块公共尾
	 public function notice_footer(){
		  $this->display(); 
	 }
	 //日常安排模块公共头
	 public function schedule_header(){
		  $this->display();
	 }
	 //日程安排模块公共尾
	 public function schedule_footer(){
		  $this->display(); 
	 }
	 //工作日志模块公共头
	 public function jobLog_header(){
		  $this->display();
	 }
	 //工作日志模块公共尾
	 public function jobLog_footer(){
		  $this->display(); 
	 }
	 //通讯录模块公共头
	 public function addressBook_header(){
		  $this->display();
	 }
	 //通讯录模块公共尾
	 public function addressBook_footer(){
		  $this->display(); 
	 }
	 //员工资料模块公共头
	 public function employeesInfo_header(){
		  $this->display();
	 }
	 //员工资料模块公共尾
	 public function employeesInfo_footer(){
		  $this->display(); 
	 }
	 //公共频道模块公共头
	 public function chatChannel_header(){
		  $this->display();
	 }
	 //公共频道模块公共尾
	 public function chatChannel_footer(){
		  $this->display(); 
	 }
	 //客户管理模块公共头
	 public function customer_header(){
		  $this->display();
	 }
	 //客户管理模块公共尾
	 public function customer_footer(){
		  $this->display(); 
	 }
	 //权限管理模块公共头
	 public function permissions_header(){
		  $this->display();
	 }
	 //权限管理模块公共尾
	 public function permissions_footer(){
		  $this->display(); 
	 }
	 
	 //办公桌定时刷新局部
	 public function main_info(){
	 $Uid  = session('UserId');
	      $user = M('employees'); 
		//多表查询，同时查询用户信息表，部门表，职位表
		$sql = "select * from oa_department as d,oa_employees as e,oa_position as p where (e.u_department = d.d_id or e.u_department = 0) and e.u_position = p.p_id and e.u_id = {$Uid}";
		$user_info = $user->query($sql);
		$this->assign("user_info",$user_info);
		
		/*未查看的短消息数量*/
			$message = M("message");
			$m_sum = $message->where("m_reUid = {$Uid} and m_looks_is = 0")->count();
			$this->assign("m_sum",$m_sum);
			
			/*调取出被评论的工作日志数量*/
			$joblog = M("joblog");
			$j_sum = $joblog->where("j_uid = {$Uid} and j_boss_review != '' and j_look_review = 0")->count();
			$this->assign("j_sum",$j_sum);
			
			/*获取未完成的任务数量*/
			$tasks = M("tasks");
			$t_sum = $tasks->where("t_uid = {$Uid} and t_isOK = 0")->count();
			$this->assign("t_sum",$t_sum);
	        $this->display();
	 }
	 
	 //AJAX更新信息
	 public function update_mainInfo(){
		    $Uid  = session('UserId');
		   /*未查看的短消息数量*/
			$message = M("message");
			$m_sum = $message->where("m_reUid = {$Uid} and m_looks_is = 0")->count();
			
			/*调取出被评论的工作日志数量*/
			$joblog = M("joblog");
			$j_sum = $joblog->where("j_uid = {$Uid} and j_boss_review != '' and j_look_review = 0")->count();
			
			/*获取未完成的任务数量*/
			$tasks = M("tasks");
			$t_sum = $tasks->where("t_uid = {$Uid} and t_isOK = 0")->count();
			
			echo $m_sum."|".$j_sum."|".$t_sum;
	 }
  } 
?>